﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTcms.Common;

namespace DTcms.Web.admin.dialog
{
    public partial class dialog_group : Web.UI.ManagePage
    {
        private int user_id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            this.user_id = DTRequest.GetQueryInt("user_id");
            if (this.user_id == 0)
            {
                JscriptMsg("传输参数不正确！", "back");
                return;
            }
            if (!new BLL.users().Exists(this.user_id))
            {
                JscriptMsg("信息不存在或已被删除！", "back");
                return;
            }
            if (!Page.IsPostBack)
            {
                ShowInfo(this.user_id);
            }
        }

        #region 赋值操作=================================
        private void ShowInfo(int _user_id)
        {
            int cur_group_id = new BLL.users().GetGroupID(_user_id);
            BLL.user_groups bll = new BLL.user_groups();
            DataTable dt = bll.GetList(0, "", "id asc").Tables[0];
            ddlGroupId.Items.Clear();
            ddlGroupId.Items.Add(new ListItem("请选择升级后的等级", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddlGroupId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }
            ddlGroupId.SelectedValue = cur_group_id.ToString();
        }
        #endregion
    }
}